<template>
  <div>
    <h1 style="margin: 1% 0px 1% 1%">客服管理</h1>
    <div
      class="Opacity"
      v-show="state1"
      @click="
        state1 = !state1;
        state2 = !state2;
      "
    ></div>
    <div class="NewDiv">
      <div class="Returns">
        <hr style="margin: 0 auto; width: 100%" />
        <el-button
          class="iconfont icon-fanhui"
          style="margin-left: 1%"
          @click="goAirlines"
          >返回</el-button
        >
      </div>

      <div class="inputcontent">
        <div class="inputdiv">
          <h4>类型</h4>
          <el-select v-model="addData" clearable placeholder="售后">
            <el-option label="售后" value="beijing"> </el-option>
            <el-option label="投诉" value="beijing"> </el-option>
          </el-select>
        </div>
        <div class="inputdiv">
          <h4>状态</h4>
          <el-select v-model="addData" clearable placeholder="新客服">
            <el-option label="新客服" value="beijing"> </el-option>
            <el-option label="处理中" value="beijing"> </el-option>
            <el-option label="已完成" value="beijing"> </el-option>
            <el-option label="已取消" value="beijing"> </el-option>
          </el-select>
        </div>

        <div class="inputdiv">
          <h4>客服编号</h4>
          <el-input value=""></el-input>
        </div>
        <div class="inputdiv icons">
          <h4>标题</h4>
          <el-input></el-input>
        </div>
        <div class="inputdiv icons">
          <h4>服务方式</h4>
          <el-input value=""></el-input>
        </div>
        <div class="inputdiv icons">
          <h4>来源</h4>
          <el-input></el-input>
        </div>
        <div class="inputdiv">
          <h4>服务日期</h4>
          <el-date-picker
            v-model="value1"
            type="date"
            placeholder="选择日期"
            style="width: 100%"
          >
          </el-date-picker>
        </div>
        <div class="inputdiv icons">
          <h4>客户</h4>
          <el-input></el-input>
          <span
            class="iconfont icon-sousuo"
            @click="
              state1 = !state1;
              state2 = !state2;
            "
          >
            查找
          </span>
        </div>
        <div class="inputdiv" style="height: 200px">
          <h4>客户反馈</h4>
          <textarea cols="60" rows="10" style="width: 100%"></textarea>
        </div>
        <div class="inputdiv">
          <h4>服务内容</h4>
          <textarea cols="60" rows="10" style="width: 100%"></textarea>
        </div>
      </div>

      <div class="rtf">
        <div id="toolbar-container"></div>
        <div id="editor-container"></div>
      </div>
      <div class="files">
        <el-upload
          action="https://jsonplaceholder.typicode.com/posts/"
          multiple
          :limit="3"
          :file-list="fileList"
          style="display: inline-block; margin-left: 1%"
        >
          <el-button
            size="small"
            type="primary"
            class="iconfont icon-fujian addfile"
            >增加附件</el-button
          >
        </el-upload>
        <el-button
          size="small"
          type="primary"
          class="iconfont icon-chacha removefile"
          @click="beforeRemove()"
          >移出</el-button
        >
      </div>
      <div class="soleFn">
        <el-button
          style="background-color: #208adb; color: #fff; margin-left: 1%"
          @click="saveAirlines"
          >保存</el-button
        >
        <el-button @click="cancelAirlines">取消</el-button>
      </div>
    </div>

    <div class="trailPopout" v-show="state2">
      <span class="iconfont icon-untitled96 find" @click="find"></span>
      <div class="trailPopout1">
        <div class="Popoutcontent">
          <hr />
          <div class="divHeader">
            <span>查找患者</span>
            <el-row class="Menu clear">
              <el-button
                style="color: #444444; background-color: #f4f4f4"
                icon="el-icon-search"
                class="btnright"
              ></el-button>
              <el-input placeholder="查找....."></el-input>
            </el-row>
          </div>
          <el-table
            style="width: 100%"
            :header-cell-style="{ 'background-color': '#f7f7f7' }"
          >
            <el-table-column prop="address" label="类型"> </el-table-column>
            <el-table-column prop="address" label="患者名称"> </el-table-column>
            <el-table-column prop="address" label="性别"> </el-table-column>
            <el-table-column prop="address" label="年龄"> </el-table-column>
            <el-table-column prop="address" label="手机号码" width="120px">
            </el-table-column>
            <el-table-column prop="address" label="身份证号" width="200">
            </el-table-column>
            <el-table-column prop="address" label="负责人"> </el-table-column>
            <el-table-column prop="address" label="状态"> </el-table-column>
            <el-table-column prop="address" label="操作" width="100px">
            </el-table-column>
          </el-table>
          <div class="pageStyle">
            <ul class="ulLeft">
              <li>共条|</li>
              <li>每页条|</li>
              <li>共页</li>
            </ul>
            <ul class="ulRight">
              <el-button
                class="iconfont icon-zhishouye"
                @click="homePage"
                title="至首页"
              ></el-button>
              <el-button
                class="iconfont icon-triangle-left"
                @click="lastPage"
                title="至尾页"
              ></el-button>
              <div class="pages"><el-button>1</el-button></div>
              <el-button
                class="iconfont icon-triangle-right"
                @click="prevPage"
                title="上一页"
              ></el-button>
              <el-button
                class="iconfont icon-zhiweiye"
                @click="nextPage"
                title="下一页"
              ></el-button>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
// import "@wangeditor/editor/dist/css/style.css";
// import {
//   createEditor,
//   createToolbar,
//   // IEditorConfig,
//   // IDomEditor,
// } from "@wangeditor/editor";

export default {
  data() {
    return {
      //遮盖层状态
      state1: false,
      //查找弹框显示状态
      state2: false,
      addData: [],
      //时间
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        },
        shortcuts: [
          {
            text: "今天",
            onClick(picker) {
              picker.$emit("pick", new Date());
            },
          },
          {
            text: "昨天",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() - 3600 * 1000 * 24);
              picker.$emit("pick", date);
            },
          },
          {
            text: "一周前",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", date);
            },
          },
        ],
      },
      value1: "",
      //上传文件
      fileList: [
        // {
        //   name: "food.jpeg",
        //   url: "https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100",
        // },
      ],
    };
  },

  mounted() {
    //富文本方法调用
    this.editor();
  },
  methods: {
    //至首页
    homePage() {},
    //至尾页
    lastPage() {},
    //上一页
    prevPage() {},
    //下一页
    nextPage() {},
    //返回
    goAirlines() {
      this.$router.push("/airlines");
    },
    //关闭查找
    find() {
      this.state1 = !this.state1;
      this.state2 = !this.state2;
    },
    //保存判断input是否为空弹出提示/发起请求
    saveAirlines() {},
    //取消清空input并返回
    cancelAirlines() {
      this.$router.push("/Airlines");
    },
    //文件移出
    beforeRemove(file, fileList) {
      //   return this.$confirm(`确定移除 ${file.name}?`);
    },
    //富文本方法
    editor() {
      //【注意】下面使用的 typescript 语法。如用 javascript 语法，把类型去掉即可。

      const editorConfig = {};
      editorConfig.placeholder = "请输入内容";
      editorConfig.onChange = (editor) => {
        // 当编辑器选区、内容变化时，即触发
        // console.log("content", editor.children);
        // console.log("html", editor.getHtml());
      };

      // 创建编辑器
      const editor = createEditor({
        selector: "#editor-container",
        config: editorConfig,
        mode: "default", // 或 'simple' 参考下文
      });
      // 创建工具栏
      const toolbar = createToolbar({
        editor,
        selector: "#toolbar-container",
        mode: "default", // 或 'simple' 参考下文
      });
    },
  },
};
</script>

<style scoped lang="less">
* {
  margin: 0;
  padding: 0;
}
//查找
.icons {
  position: relative;
  span {
    cursor: pointer;
    color: #fff;
    background-color: green;
    position: absolute;
    top: 32%;
    right: 1%;
    height: 30px;
    width: 60px;
    line-height: 30px;
    border-radius: 5px;
  }
}
//遮盖层
.Opacity {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background-color: black;
  opacity: 0.6;
  z-index: 2;
}
//页码div
.pageStyle {
  padding: 0 10px;
  height: 50px;
  background-color: #fafafa;
  .pages {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 50px;
    padding: 0px 10px;
  }
  .ulLeft {
    float: left;
    li {
      line-height: 50px;
      float: left;
      list-style: none;
    }
  }
  .ulRight {
    float: right;
    line-height: 50px;
    text-align: center;
    .el-button {
      font-size: 12px;
      padding: 5px;
    }
  }
}
//最外层的弹框div
.trailPopout {
  border-radius: 5px;
  z-index: 3;
  width: 1000px;
  height: 300px;
  position: absolute;
  background-color: #f9f9f9;
  overflow-y: scroll;
  left: 50%;
  transform: translate(-50%);
  top: 1%;
  //第二层的弹框div
  .trailPopout1 {
    width: 950px;
    height: 400px;
    background-color: #ecf0f5;
    margin: 25px auto;
    overflow: hidden;
    //分割线
    hr {
      width: 100%;
      border: 1px solid #6c7b8b;
      background-color: #6c7b8b;
    }
    //第三层的弹框div
    .Popoutcontent {
      width: 900px;
      background-color: #fff;
      margin: 0 auto;
      margin-top: 30px;
      //头部功能键
      .divHeader {
        width: 100%;
        height: 40px;
        span {
          font-size: 25px;
          float: left;
          line-height: 50px;
          margin-left: 20px;
        }
        //头部input和搜索
        .Menu {
          .el-button {
            float: right;
            padding: 12px;
            margin: 4px 0px;
            margin-right: 20px;
          }
          .el-input {
            width: 200px;
            float: right;
            margin: 4px 0px;
          }
        }
      }
    }
  }
}

//文件
.files {
  width: 100%;
  margin: 80px auto;
  border-top: 1px solid #eeeeee;
  .addfile {
    padding: 10px;
    // margin-left: 20%;
  }
  .removefile {
    display: inline-block;
    color: #fff;
    border-radius: 5px;
    background-color: red;
    margin-left: 1%;
    padding: 10px;
  }
}
.inputcontent {
  width: 100%;
  border: 1px solid black;
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;

  .el-select {
    height: 80px;
    width: 100%;
  }
  .inputdiv {
    height: 80px;
    width: 48%;
  }
}

.NewDiv {
  margin: 0 auto;
  width: 98%;
  border: 1px solid red;
  //分割线
  hr {
    width: 98%;
    border: 2px solid #d2d6de;
    margin: 30px auto;
    box-sizing: border-box;
  }
  .demo-form-inline {
    .el-form-item {
      .el-select {
        width: 90%;
        padding: 0px 10px;
      }
      h4 {
        width: 90%;
        display: block;
        text-align: left;
        padding-left: 12px;
      }
      .el-input {
        width: 1000px;
        padding: 0px 10px;
      }
    }
  }
  .Returns {
    border: 1px solid red;
    width: 100%;
    height: 50px;
    .el-button {
      padding: 10px;
      background-color: #6c7b8b;
      color: #fff;
      font-weight: bold;
      float: left;
      margin: 6px;
      margin-left: 20px;
    }
  }
}
//富文本
.rtf {
  width: 98%;
  margin: 0 auto;
  margin-top: 30px;
  #toolbar-container {
    width: 100%;
    border: 1px solid #cccccc;
  }
  #editor-container {
    width: 100%;
    height: 500px;
    border: 1px solid #cccccc;
  }
}
//取消保存
.soleFn {
  margin: 0 auto;
  margin-top: 50px;
  width: 100%;
  height: 80px;
  border: 1px #f4f4f4 solid;
  // border: 1px solid red;
  line-height: 80px;
  // padding-left: 20px;
  box-sizing: border-box;
  .el-button {
    padding: 15px;
  }
}
.find {
  cursor: pointer;
}
</style>